<!--文件上传开始-->
<script type="text/javascript">
    //弹出文件上传的对话框
    var url = '/api/ueditor/index.html?app=admin';
    //实例化编辑器
    var upload_editor = UE.getEditor('input_editor',{
        serverUrl :url,
        UEDITOR_HOME_URL:'{:config('template.ueditor')}/',
    });
    function upFiles(morefileurl){
        upload_editor.ready(function(){
            upload_editor.execCommand('serverparam', {
                'userid': {:session('userid')},//图片子文件夹，以用户ID命名
            });
            var filekey = 1;
            upload_editor.hide();//隐藏编辑器
            //文件上传监听
            // 需要在ueditor.all.min.js文件中找到d.execCommand("insertHtml",l)之后插入d.fireEvent('afterUpfile',b)
            upload_editor.addListener('afterUpfile', function (t, arg){
                if(filekey == 1){
                    $(morefileurl).val(arg[0].url);
                }
                filekey ++;
            });
        });
        //弹出文件上传的对话框
        var myFiles = upload_editor.getDialog("attachment");
        myFiles.open();
    } 
</script>
<!--文件上传结束-->